﻿using BingoClientModel;
using BingoHallServerConsole.Model;
using BingoServerCommon.Common;
using MySql.Data.MySqlClient;

namespace BingoHallServerConsole.Business.Mall
{
	/// <summary>
	/// 客户端请求商城里的商品列表
	/// </summary>
	public class CS_MallBuyCommodity : Package
	{


		public CS_MallBuyCommodity(EnumPackCommand mainid) : base(mainid)
		{
		}

		public CS_MallBuyCommodity(byte[] buffer, int len) : base(buffer, len)
		{
		}

		public override Package Clone(byte[] bytes)
		{
			return new CS_MallBuyCommodity(bytes, bytes.Length);
		}





		/// <summary>
		/// 买商品
		/// </summary>
		public override void Excute(Session session)
		{
			

			MySqlConnection conn = Program.ConnectionPool.getConnection(); //从连接池拿到一个连接
		

			var package = new Package(EnumPackCommand.SC_MallBuyCommodity_Ret);
			//0表示成功，其余是失败
			package.Write((byte)EnumReqRetStatus.Success);
			session.Send(package);

			Program.ConnectionPool.returnConnection(conn);//连接用完回收
		}


	}
}
